﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Common;
using System.Data.SqlClient;

using JM.JCY.BusinessEntity;
using JM.JCY.Common;
using System.Data;

namespace JM.JCY.DataAccess
{
   public class ApplicationDA : JCYDataAccessBasecs
    {
        public ApplicationDataSet.T_ApplicationDataTable GetApplicationByName(string appName)
        {
            ApplicationDataSet.T_ApplicationDataTable dt = new ApplicationDataSet.T_ApplicationDataTable();
            base.Helper.Fill(dt, "P_Application_S_ById", appName);
            return dt;
        }

        public ApplicationDataSet.T_ApplicationDataTable GetApplicationByType(string appType,string isVisble)
        {
            ApplicationDataSet.T_ApplicationDataTable dt = new ApplicationDataSet.T_ApplicationDataTable();
            base.Helper.Fill(dt, "P_Application_S_ByAppType", appType,isVisble);
            return dt;
        }

        public ApplicationDataSet.T_ApplicationDataTable GetApplicationNameById(int appId)
        {
            ApplicationDataSet.T_ApplicationDataTable dt = new ApplicationDataSet.T_ApplicationDataTable();
            base.Helper.Fill(dt, "P_ApplicationNameById", appId);
            return dt;
        }




        public ApplicationDataSet.T_ApplicationRoleDataTable GetApplicationRoleByUserName(string userName)
        {
            ApplicationDataSet.T_ApplicationRoleDataTable dt = new ApplicationDataSet.T_ApplicationRoleDataTable();
            base.Helper.Fill(dt, "P_ApplicationRole_ByUserName", userName);
            return dt;
        }

        public ApplicationDataSet.T_ApplicationRoleDataTable GetApplicationRoleByAppId(int appId)
        {
            ApplicationDataSet.T_ApplicationRoleDataTable dt = new ApplicationDataSet.T_ApplicationRoleDataTable();
            base.Helper.Fill(dt, "P_ApplicationRole_ByAppId", appId);
            return dt;
        }

        public void DeleteApplicationRoleByAppId(int appId)
        {
            base.Helper.ExecuteNonQuery("P_DeleteApplicationRole_ByAppId", appId);
        }

        public void CreateApplicationRole(ApplicationDataSet.T_ApplicationRoleDataTable dt)
        {
            base.Helper.Update(dt);
        }
    }
}
